
#include "ColleagueB.h"
#include <iostream>

using namespace npMediator;


//other constructors
ColleagueB::ColleagueB(int id, weak_ptr<Mediator> mediator) : Colleague(id, mediator)
{

}

//public methods
void ColleagueB::send(const string& msg, int targetId) throw(Colleague::ErrorEnum)
{
    if (shared_ptr<Mediator> mediator = this->getMediator().lock())
    {
        mediator->send(msg, targetId);
    }
    else
    {
        throw Colleague::ErrorEnum::NullMediator;
    }
}

void ColleagueB::notify(const string& msg) throw()
{
    cout << "\"" << msg << "\", B got a message." << endl;
}

//protected methods

//private methods

//static part

//others
